package com.itheima.Demo01;
//使用同步代码块解决线程安全问题;
public class AAA implements Runnable{
    int a = 100;
    @Override
    public void run() {
        while (true){
            synchronized ("锁"){
                if(a<=0){
                    break;
                }
                System.out.println(Thread.currentThread().getName()+"卖出了"+a+"号票");
                a--;
            }
        }
    }
}
